package com.smart.manager.finance.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.smart.common.entities.ajax.AjaxResult;
import com.smart.common.entities.constant.SmartConstant;
import com.smart.common.entities.core.Page;
import com.smart.common.excle.domain.ExcleExportRs;
import com.smart.manager.finance.entities.bodys.ROrderCoin;
import com.smart.manager.finance.entities.models.FinanceOrderCoin;
import com.smart.manager.finance.repository.OrderCoinRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author Administrator
 */

@Api(tags = "充值订单管理")
@RestController
@RequestMapping(SmartConstant.MANAGER_API_PREFIX + "finance/order/coin")
@RequiredArgsConstructor
public class OrderCoinApi {

    private final OrderCoinRepository orderCoinRepository;


    @GetMapping(value = "pageList")
    @ApiOperation(value = "查询充值订单")
    @SaCheckPermission("finance:order:coin:pageList")
    public AjaxResult<Page<FinanceOrderCoin>> pageList(@Validated ROrderCoin.SearchBody body) {
        Page<FinanceOrderCoin> result = orderCoinRepository.pageList(body);
        return AjaxResult.data(result);
    }

    @GetMapping(value = "export")
    @ApiOperation(value = "导出数据")
    public AjaxResult<ExcleExportRs> export(ROrderCoin.SearchBody search) {
        ExcleExportRs export = orderCoinRepository.export(search);
        return AjaxResult.data(export);
    }



}
